package one.stand.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import one.stand.model.FinanceModel;
import one.stand.model.ResultModel;
import one.stand.request.AdminRecordRequest;
import one.stand.request.AdminRequest;
import one.stand.request.FinanceRequest;
import one.stand.response.AdminResponse;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author: ZRH
 * @CreateDate: 2019/4/17 9:45
 */
@RestController
@RequestMapping("adminApi/index")
@Api(description = "PC首页")
public class IndexController extends BaseController{

    @ApiOperation(value = "企业首页数据统计")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "days", value = "天数", paramType = "Integer"),
            @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "String"),
            @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "String"),
    })
    @PostMapping("indexData")
    public ResultModel<FinanceModel> indexData(FinanceRequest request) {
        return adminFegin.indexData(request);
    }

    @ApiOperation(value = "查询管理员操作记录列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "adminId", value = "管理者id", paramType = "Integer"),
            @ApiImplicitParam(name = "company_id", value = "公司id", paramType = "String"),
            @ApiImplicitParam(name = "name", value = "员工名称、公司名称", paramType = "String"),
    })
    @PostMapping("selectAdminRecordList")
    public ResultModel<Map<String, Object>> selectAdminRecordList(AdminRecordRequest request) {
        return adminFegin.selectAdminRecordList(request);
    }

    @ApiOperation(value = "企业首页数据统计折线图")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "days", value = "天数(7,15,30),固定这三个", paramType = "Integer"),
    })
    @PostMapping("newCountList")
    public ResultModel<Map<String, List<Map<String, Object>>>> newCountList(FinanceRequest request) {
        return adminFegin.newCountList(request);
    }

    @ApiOperation(value = "数据中心-数据概况")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "companyType", value = "1名片端   2企业端", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "days", value = "天数", paramType = "Integer"),
            @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "String"),
            @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "String"),
    })
    @PostMapping("dataCenter")
    public ResultModel<Map<String, Object>> dataCenter(FinanceRequest request) {
        return adminFegin.dataCenter(request);
    }

    @ApiOperation(value = "数据中心-用户增长情况")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "companyType", value = "1名片端   2企业端", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "days", value = "天数", paramType = "Integer"),
    })
    @PostMapping("newUserCountList")
    public ResultModel<List<Map<String, Object>>> newUserCountList(FinanceRequest request) {
        return adminFegin.newUserCountList(request);
    }

    @ApiOperation(value = "数据中心-使用人数增长情况")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "companyType", value = "1名片端   2企业端", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "days", value = "天数", paramType = "Integer"),
    })
    @PostMapping("userUseCountList")
    public ResultModel<List<Map<String, Object>>> userUseCountList(FinanceRequest request) {
        return adminFegin.userUseCountList(request);
    }

    @ApiOperation(value = "用户画像-性别分布")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "companyType", value = "1名片端   2企业端", required = true, paramType = "Integer"),
    })
    @PostMapping("userSexCount")
    public ResultModel<List<Map<String, Object>>> userSexCount(FinanceRequest request) {
        return adminFegin.userSexCount(request);
    }

}
